package com.jinghong.registerlogin.mapper;

import com.jinghong.registerlogin.anno.Log;
import com.jinghong.registerlogin.model.pojo.Evaluation;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * ClassName:EvaluationMapper
 * Package:com.jinghong.registerlogin.mapper
 * Description:
 *
 * @Author: 寻月君子
 * @CreatTime:2024/5/26 18:23
 * Version:1.0
 */
@Mapper
public interface EvaluationMapper {

    @Delete("delete from `register_login`.evaluation where paper_id = #{id}")
     void deleteByPaperId(Integer id);
    //增

    /**
     * 新增考核评价
     * @param evaluation 考核评价
     */
    @Insert("insert into `register_login`.evaluation(user_id, paper_id, get_score, summary, advice, creat_time) " +
            "values" +
            " (#{userId},#{paperId},#{getScore},#{summary,jdbcType=VARCHAR},#{advice,jdbcType=VARCHAR},now())")
    @SelectKey(before = false,keyProperty = "id",resultType = Integer.class,statement = "SELECT LAST_INSERT_ID()")
    void insert(Evaluation evaluation);


    /**
     * 修改评价信息
     * @param evaluation
     */
    void update(Evaluation evaluation);

    @Select("select * from `register_login`.evaluation where id = #{id}")
    Evaluation getById(int id);


    List<Integer> getByPaperId(Integer id);
}
